import { useState } from 'react';
import styles from './index.less';
import { Link } from 'umi';

//链接列表
const links = [
  {
    url: 'https://www.cnblogs.com/wuhairui/',
    text: '我的博客',
  },
  {
    url: 'http://www.bilibili.com/',
    text: 'bilibili首页',
  },
  {
    url: '/myOnlineClass',
    text: 'bili网课吧',
  },
];
console.log('插件运行中');
/**
 * 首页
 */
const IndexPage = () => {
  return (
    <div className={styles.root}>
      <div>
        <p>链接列表：</p>
        <p className={styles.links}>
          {links.map((l, i) => {
            if (l.url.includes('http')) {
              return (
                <a key={i} href={l.url} target="_blank">
                  {l.text}
                </a>
              );
            }
            return (
              <Link key={i} to={l.url} target="_blank">
                {l.text}
              </Link>
            );
          })}
        </p>
      </div>
    </div>
  );
};

export default IndexPage;
